.sales-order {
  padding: 16px;
  background-color: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;

  // 页面标题
  .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 8px 0;
    border-bottom: 1px solid #e8e8e8;

    .page-title {
      font-size: 20px;
      font-weight: 500;
      color: #1890ff;
    }

    .expiry-date {
      color: #666;
      font-size: 14px;
    }
  }

  // 顶部按钮区
  .action-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;

    .left-actions {
      display: flex;
      gap: 8px;
    }

    .right-actions {
      display: flex;
      align-items: center;
      
      .price-type {
        display: flex;
        align-items: center;
        gap: 8px;
      }
    }
  }

  // 订单信息区
  .order-info {
    background-color: #fafafa;
    padding: 16px;
    border-radius: 4px;
    margin-bottom: 16px;

    .info-row {
      display: flex;
      gap: 24px;
      flex-wrap: wrap;

      .info-item {
        display: flex;
        align-items: center;

        &.required label::before {
          content: '*';
          color: #ff4d4f;
          margin-right: 4px;
        }

        label {
          width: 80px;
          text-align: right;
          margin-right: 8px;
          color: #666;
        }

        .quick-add {
          margin-left: 8px;
          padding: 0;
        }
      }
    }
  }

  // 商品表格
  .product-table {
    flex: 1;
    margin-bottom: 16px;

    .ant-table-wrapper {
      height: 100%;
      
      .ant-table {
        .ant-table-thead {
          > tr > th {
            background-color: #fafafa;
            font-weight: 500;
            padding: 8px;
            height: 40px;
            position: relative;
            
            &::before {
              display: none;
            }

            &.required::before {
              content: '*';
              color: #ff4d4f;
              margin-right: 4px;
            }

            // 拖拽手柄样式
            .react-resizable-handle {
              position: absolute;
              right: -5px;
              bottom: 0;
              z-index: 1;
              width: 10px;
              height: 100%;
              cursor: col-resize;
              background: transparent;
              transition: background-color 0.2s;

              &::after {
                content: '';
                position: absolute;
                right: 4px;
                top: 0;
                bottom: 0;
                width: 2px;
                background-color: transparent;
                transition: background-color 0.2s;
              }

              &:hover::after {
                background-color: #1890ff;
              }

              &.resizing::after {
                background-color: #1890ff;
                opacity: 1;
              }
            }

            &.resizing {
              background-color: #e6f7ff;
              
              .react-resizable-handle {
                &::after {
                  background-color: #1890ff;
                  opacity: 1;
                }
              }
            }

            // 拖拽时的样式
            &.dragging {
              background-color: #f5f5f5;
              cursor: move;

              .react-resizable-handle {
                display: none;
              }
            }

            &.drop-over-left {
              border-left: 2px solid #1890ff;
            }

            &.drop-over-right {
              border-right: 2px solid #1890ff;
            }
          }
        }

        .ant-table-tbody {
          > tr {
            &:nth-child(even) {
              background-color: #fafafa;
            }

            > td {
              padding: 4px 8px;
              height: 40px;
              border-bottom: 1px solid #f0f0f0;

              .ant-input {
                border: none;
                background: transparent;
                padding: 0;
                height: 28px;

                &:hover, &:focus {
                  border: 1px solid #d9d9d9;
                  background: #fff;
                  padding: 0 8px;
                }
              }

              // 空白单元格样式
              .empty-cell {
                height: 28px;
                cursor: pointer;

                &:hover {
                  background-color: rgba(24, 144, 255, 0.1);
                }
              }

              // 商品名称单元格
              .product-name {
                color: #1890ff;
                cursor: pointer;

                &.empty-cell {
                  color: inherit;
                }

                &:hover {
                  text-decoration: underline;
                }
              }
            }
          }
        }

        // 操作列样式
        .row-actions {
          display: flex;
          gap: 4px;
          justify-content: center;

          .ant-btn {
            padding: 0;
            height: 24px;
            width: 24px;
            min-width: 24px;
            
            &.add-btn {
              color: #52c41a;
            }
            
            &.delete-btn {
              color: #ff4d4f;
            }
          }
        }

        // 金额列样式
        .amount-cell {
          text-align: right;
          padding-right: 8px;
        }
      }
    }
  }

  // 底部信息
  .order-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding: 16px;
    background-color: #fafafa;
    border-radius: 4px;

    .left-info {
      display: flex;
      flex-direction: column;
      gap: 16px;

      .info-item {
        display: flex;
        align-items: center;
        gap: 8px;

        label {
          min-width: 70px;
          text-align: right;
        }
      }
    }

    .right-info {
      display: flex;
      flex-direction: column;
      gap: 16px;

      .discount-row,
      .amount-row,
      .total-row {
        display: flex;
        align-items: center;
        gap: 16px;

        label {
          min-width: 70px;
          text-align: right;
        }
      }

      .total-row {
        .amount-info {
          display: flex;
          align-items: center;
          gap: 8px;

          .amount {
            color: #f5222d;
            font-weight: 500;
          }

          .calc-amount {
            color: #1890ff;
          }

          .total-amount {
            margin-left: 16px;
            font-size: 16px;
            font-weight: 500;
            color: #f5222d;
          }
        }
      }
    }
  }

  // 附件上传区域
  .attachment-upload {
    margin-top: 16px;
    padding: 16px;
    background-color: #fafafa;
    border-radius: 4px;

    .upload-wrapper {
      .ant-upload-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
      }

      .upload-button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        
        .anticon {
          font-size: 24px;
          color: #1890ff;
          margin-bottom: 8px;
        }
        
        .upload-text {
          color: #666;
        }
      }

      .upload-tip {
        margin-top: 8px;
        color: #999;
        font-size: 12px;
      }
    }
  }

  // 操作选项弹窗样式
  .add-options {
    padding: 8px 16px;
    
    .ant-btn {
      height: 40px;
      font-size: 14px;
      
      &:hover {
        color: #1890ff;
        border-color: #1890ff;
      }
    }
  }
}

// 必填列标题样式
.ant-table-thead th.required::before {
  content: '*';
  color: #ff4d4f;
  margin-right: 4px;
}

// 固定列样式
.ant-table-cell-fix-left {
  background: inherit !important;
}

// 导入商品弹窗样式
.import-product-modal {
  .import-content {
    padding: 16px;

    .import-section {
      margin-bottom: 24px;

      h3 {
        font-size: 14px;
        color: #333;
        margin-bottom: 16px;
      }

      .template-download {
        text-align: center;
        padding: 24px;
        background-color: #fafafa;
        border-radius: 4px;

        .download-icon {
          font-size: 32px;
          color: #1890ff;
          margin-bottom: 8px;
        }

        .download-text {
          color: #666;
          margin-bottom: 16px;
        }
      }

      .file-upload {
        text-align: center;
        padding: 24px;
        background-color: #fafafa;
        border: 2px dashed #d9d9d9;
        border-radius: 4px;
        position: relative;
        cursor: pointer;

        &:hover {
          border-color: #1890ff;
        }

        .upload-icon {
          font-size: 32px;
          color: #1890ff;
          margin-bottom: 8px;
        }

        .upload-text {
          color: #666;
          margin-bottom: 8px;
        }

        .upload-tip {
          color: #999;
          font-size: 12px;
        }

        .file-input {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          opacity: 0;
          cursor: pointer;
        }
      }
    }

    .import-guide {
      color: #666;
      font-size: 14px;

      ol {
        margin-top: 8px;
        padding-left: 20px;

        li {
          margin-bottom: 8px;
          line-height: 1.5;
        }
      }
    }
  }
}

// 列设置弹窗样式
.column-setting-modal {
  .column-setting-content {
    padding: 16px;

    .select-all {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 16px;
      border-bottom: 1px solid #f0f0f0;
      margin-bottom: 16px;

      .tip {
        color: #999;
        font-size: 13px;
      }
    }

    .column-list {
      max-height: 400px;
      overflow-y: auto;
      padding: 0 8px;

      .column-item {
        user-select: none;
        margin-bottom: 8px;
        transition: all 0.2s;

        &.dragging {
          background: #fafafa;
          border-radius: 4px;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);

          .item-content {
            background: #fafafa;
            border-color: #d9d9d9;
          }
        }

        .item-content {
          display: flex;
          align-items: center;
          padding: 8px 12px;
          border: 1px solid #f0f0f0;
          border-radius: 4px;
          background: #fff;
          transition: all 0.2s;

          &:hover {
            background-color: #fafafa;
            border-color: #d9d9d9;
          }

          .drag-handle {
            color: #bfbfbf;
            margin-right: 12px;
            cursor: move;
            display: flex;
            align-items: center;
            
            &:hover {
              color: #666;
            }
          }

          .ant-checkbox-wrapper {
            flex: 1;
            margin-left: 0;
            cursor: pointer;

            &:hover {
              .ant-checkbox-inner {
                border-color: #1890ff;
              }
            }
          }
        }
      }
    }
  }

  .ant-modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 16px 24px;
    text-align: right;

    .ant-btn + .ant-btn {
      margin-left: 8px;
    }
  }
}

// 拖拽时的全局样式
.react-resizable {
  position: relative;
  background-clip: padding-box;

  &.resizing {
    user-select: none;
    
    .react-resizable-handle {
      &::after {
        background-color: #1890ff;
        opacity: 1;
      }
    }
  }
}

.react-resizable-handle {
  position: absolute;
  width: 10px;
  height: 100%;
  bottom: 0;
  right: -5px;
  cursor: col-resize;
  z-index: 1;
  
  &::after {
    content: '';
    position: absolute;
    right: 4px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: transparent;
    transition: background-color 0.2s;
  }

  &:hover::after {
    background-color: rgba(24, 144, 255, 0.5);
  }
} 